package com.uyaer.engine.loader
{
	import com.uyaer.engine.Cfg;

	public class URI
	{
		public var protocol:String;
		public var domain:String;
		public var name:String;
		public var ext:String;
		
		public static var protocolRex:RegExp = /$\d+\:\/\//;
		public static var domianRex:RegExp = /\:\/\/d+?\//;
		//https://www.ad.12/jfsl/wle.png
		public function URI()
		{
			
		}
		
		public static function parseURI(uriStr:String):URI{
			var uri:URI = new URI();
			var arr:Array = uriStr.match(URI.protocolRex);
			uri.protocol = arr && arr.length && arr[0];
			arr = uriStr.match(URI.domianRex);
			uri.domain = arr && arr.length && arr[0];
			var index:int = uriStr.lastIndexOf(".");
			uri.ext = uriStr.slice(index+1);
			uri.name = uriStr.slice(uriStr.lastIndexOf("/")+1,index);
			return uri;
		}
		
		public static function makeGameObjectURI(url:String , type:String):String{
			var path:String = Cfg.GAMEOBJECT_VIEW + url + "." + type;
			return path;
		}
	}
}